<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/style2.0.css">
<style type="text/css">
ul li {
	font-size: 25px;
	color: #2ec0f6;
}

.tyg-div {
	z-index: -1000;
	float: left;
	position: absolute;
	left: 5%;
	top: 20%;
}

.tyg-p {
	font-size: 14px;
	font-family: 'microsoft yahei';
	position: absolute;
	top: 150px;
	left: 80px;
}

.tyg-div-denglv {
	z-index: 1000;
	float: right;
	position: absolute;
	right: 5%;
	top: 1%;
}

.tyg-div-form {
	background-color: #23305a;
	width: 280px;
	height: auto;
	margin: 130px auto 0 auto;
	color: #2ec0f6;
}

.tyg-div-form form {
	padding: 10px;
}

.tyg-div-form form input[type="text"] {
	width: 230px;
	height: 30px;
	margin: 10px 10px 1px 1px;
}
.tyg-div-form form button {
	cursor: pointer;
	width: 230px;
	height: 44px;
	margin-top: 25px;
	padding: 0;
	background: #2ec0f6;
	-moz-border-radius: 6px;
	-webkit-border-radius: 6px;
	border-radius: 6px;
	border: 1px solid #2ec0f6;
	-moz-box-shadow: 0 15px 30px 0 rgba(255, 255, 255, .25) inset, 0 2px 7px
		0 rgba(0, 0, 0, .2);
	-webkit-box-shadow: 0 15px 30px 0 rgba(255, 255, 255, .25) inset, 0 2px
		7px 0 rgba(0, 0, 0, .2);
	box-shadow: 0 15px 30px 0 rgba(255, 255, 255, .25) inset, 0 2px 7px 0
		rgba(0, 0, 0, .2);
	font-family: 'PT Sans', Helvetica, Arial, sans-serif;
	font-size: 14px;
	font-weight: 700;
	color: #fff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .1);
	-o-transition: all .2s;
	-moz-transition: all .2s;
	-webkit-transition: all .2s;
	-ms-transition: all .2s;
}
div #VerifyCode{
cursor: pointer;
}
div #inputVerifyCode{
    
}
</style>
<body>
	<div class="tyg-div">
		<ul>
			<li>让</li>
			<li><div style="margin-left: 20px;">网</div></li>
			<li><div style="margin-left: 40px;">购</div></li>
			<li><div style="margin-left: 60px;">改</div></li>
			<li><div style="margin-left: 80px;">变</div></li>
			<li><div style="margin-left: 100px;">生</div></li>
			<li><div style="margin-left: 120px;">活</div></li>
		</ul>
	</div>
	<div id="contPar" class="contPar">
		<div id="page1" style="z-index: 1;">
			<div class="title0">京东商城后台</div>
			<div class="title1">管理、分配、查询、统计、更新</div>
			<div class="imgGroug">
				<img alt="" class="img0 png" src="./img/page1_0.png"> <img
					alt="" class="img1 png" src="./img/page1_1.png"> <img alt=""
					class="img2 png" src="./img/page1_2.png">
			</div>
			<img alt="" class="img3 png" src="./img/page1_4.jpg">
		</div>
	</div>
	<div class="tyg-div-denglv">
		<div class="tyg-div-form">
			<form>
				<h2>登录</h2>
				<p class="tyg-p">欢迎进入京东后台</p>
				<br />
				<div>
					<input id="name" type="text" placeholder="请输入账号..."
						name="loginname" />
					<div id="usernametip"
						style="width: 300px; height: 20px; font-size: 10px;"></div>
				</div>
				<div>
					<input id="password" type="text" placeholder="请输入密码..."
						name="loginpassword" />
					<div id="passwordtip"
						style="width: 300px; height: 20px; font-size: 10px;"></div>
				</div>
				
				<div>
					<input type="text" id="inputVerifyCode" style="width: 147px;" placeholder="请输入验证码..." />
					<a href="javascript:_yf()"><img id="VerifyCode"  src="<c:url value='../VerifyCodeServlet'/>" style="vertical-align: bottom;" alt="验证码" /></a>
				    <div id="VerifyCodetip"
						style="width: 300px; height: 20px; font-size: 10px;"></div>
				</div>
				<br />
				<input id="submit" type="button" value="登录"
					style="width: 240px; height: 40px; border: solid 1px lightskyblue; color: white; background-color: lightskyblue; cursor: pointer; border-radius: 6px;">

			</form>
		</div>
	</div>
	<script type="text/javascript" src="./js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="./js/com.js"></script>
	<script type="text/javascript">
		$(function() {
			$("#name").blur(
					function() {
						$.getJSON("../AdminServlet?method=loginname&&name="
								+ $(this).val(), {}, function(date) {
							if (date) {
								$("#usernametip").text("");
							} else {
								$("#usernametip").text("你好，你的用户名不存在!");
								$("#name").val("");
							}
						});
					})
		
				if ($("#name").val() != '') {
				$("#name").blur(
						function() {
							$.getJSON("../AdminServlet?method=loginname&&name="
									+ $(this).val(), {}, function(date) {
								if (date) {
									$("#usernametip").text("");
								} else {
									$("#usernametip").text("用户名不存在，请重新输入!");
									$("#name").val("");
								}
							})
				})
}
			$("#submit").click(function() {
				if ($("#name").val() != '' && $("#password").val() != ''&&$("#inputVerifyCode").val()!='') {
					$.ajax({
						url : "../AdminServlet?method=loginVerification",
						data : {
							name : $("#name").val(),
							password : $("#password").val()
						},
						type : "post",
						dataType : "json",
						async : true,
						cache : false,
						success : function(data) {
							if (data) {
								var inputcode=$("#inputVerifyCode").val();
								$.getJSON("../AdminServlet?method=ajaxValidateVerifyCode&code="+inputcode,{},
										function(data){
									    if(data){
									    	window.location.href = "../lyj/index.jsp";
									    }else{
											$("#VerifyCodetip").text("验证码有误!");
											$("#VerifyCode").attr("src", "../VerifyCodeServlet?a=" + new Date().getTime());
									    }
								})
							
							} else {
								$("#passwordtip").text("抱歉，你输入密码有误!");
							}
						}
					});
					
				} else {
					if ($("#password").val() == '') {
						$("#passwordtip").text("请输入你的密码!");
					}
					if ($("#name").val() == '') {
								$("#usernametip").text("请输入你的用户名!");
					}
					if ($("#inputVerifyCode").val() == '') {
						$("#VerifyCodetip").text("请输入验证码!");
			}
			
				}
				
			});
		})
			function _yf() {
		$("#VerifyCode").attr("src", "../VerifyCodeServlet?a=" + new Date().getTime());
	}
	</script>
</body>